package gupao.concurrency.configuration;

import gupao.concurrency.ratelimit.SemaphoreRateLimiter;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class ApiConfiguration {

    @Bean("xxxApiRateLimiter")
    public SemaphoreRateLimiter xxxApiConcurrentRateLimiter(@Value("${api.concurrent.rate}") int permits) {
        return new SemaphoreRateLimiter(permits);
    }
}
